<?php 
require dirname(__FILE__).'/includes/common.inc.php';
$head['title'] = $SETTING['sitename'].'_'.$SETTING['meta_title'];
$head['keywords'] = $SETTING['meta_keywords'];
$head['description'] = $SETTING['meta_description'];
header('Last-Modified: '.gmdate('D, d M Y H:i:s', TIME).' GMT');
header('Expires: '.gmdate('D, d M Y H:i:s', TIME+CACHE_PAGE_INDEX_TTL).' GMT');
header('Cache-Control: max-age='.CACHE_PAGE_INDEX_TTL.', must-revalidate');
session_start();


	// 查看伪静态实际url地址情况
	//dump($_SERVER);
	
	if($module){
		$file = $file ? $file : $module;
		$file_path = WWW_ROOT."modules/$module/".$file.".inc.php";
		
		// 系统模块目录
		if(file_exists($file_path)){
			include($file_path);
		}
		else{
			// 自定义模块目录 
			$site_module_file_path = WWW_ROOT."sites/modules/$module/".$file.".inc.php";
			if(file_exists($site_module_file_path)){
				include($site_module_file_path);
			}
			else{
				showmessage("{$site_module_file_path}文件不存在");
			}
		}
	}
	else{
		$_userid ? include template('logined.html') : include template('index.html');
		//include template('index.html');
		cache_page(CACHE_PAGE_INDEX_TTL);
	}
?>